Intel SGX Remote Attestation
OPERA: Open Remote Attestation for Intel’s Secure Enclaves
https://gyazo.com/2cc36f4c882c25904a9e8929b48fafd6
https://gyazo.com/c2b9c743c4f371b7a92eb3b70a2071de
Provisioning Protocol
SGXがPPIDとTCB versionをIPSへ送信
IPSがPPIDを検証し、EPID groupへ追加
同じCPUタイプで同じTCBバージョンであると同じEPIDグループ
1グループあたり数millionマシン
IPSはEPID group keyをSGXへレスポンス
PvEがIPSとEPID join protocolを起動しEPID member private keyを生成し、seal keyによりpersistent storageに保存されIntel QEヘシェア
DCAPは “an on-premise remote attestation capability” that is used for data centersとしてデザイン
Enclave内のSecure computationにintegrityを与える
https://asokan.org/asokan/research/
https://asokan.org/asokan/research/AsiaCCS-Attestation_Tutorial_v7.pdf
https://asokan.org/asokan/research/Asokan-DAC-IoT-attestation.pdf
terms
SP: Service Provider,
ISV: Independent Software Vendor
Intel Attestation Service
AE: Architecture Enclave
PSE: Platform Service Enclave
https://gyazo.com/8461cb494263bcd0deb4c9953277dde7
e-fugesにはprovisioning secretとseal secretがストア
provisioning secretはchip製造時に作られ、intelも保持
seal secretはEGETKEYによりenclave内で生成されるのでintelも知らない。
EGETKEYでe-fuges内のprovisoning secretを読み込み、それをIASが検証しEPIDグループ鍵を取得
メンバー秘密鍵による署名は匿名化(re-randomize?)
https://gyazo.com/2ba6826db3fd4e23d76b6a5067281e19
(https://software.intel.com/en-us/articles/code-sample-intel-software-guard-extensions-remote-attestation-end-to-end-example )
Challenger: Service provider
attestationを検証する通常マシン
ISV: Independent Software Vendor: application with its enclave
秘密計算を行うenclaveマシン
IAS (Intel Attestation Service):
enclaveを検証するintelサーバー
stages
(ISV -> SP: msg0 & msg1) ISVがSPに公開鍵とCPU informationを送信
SP -> ISVにRA stating claimを送信。
ISVのuntrusted componentがEnclaveを生成(enclave_init_ra()を起動)
ISVのtrusted compoonentがsgx_ra_init()をcall
SPの公開鍵を引数にとる
鍵交換に必要な情報をISVのuntrustedにリターン
ISVのuntrutedがsgx_get_extended_epid_group_id()をcallし、p_extended_epid_group_idをSPにmsg0として送信。
このEPIDがISV CPUのコンテキストの役割
ISVはsgx_ra_get_msg1()をcallし、公開鍵とGID(EPID-GID)を含む構造体をmsg1としてSPに送る。
(SP -> ISV: msg2) SPはDHKE用の共通鍵を生成し、IASにISVのCPU informationを送信、それらを元にSPがISVにmsg2を送る
SPはmsg1を受け取ったらsp_ra_proc_msg1_req()をcallしmsg2を生成
ISVのDHKEを検証
SPのDHKEを生成
IASにSigRLをclaim
code: msg2
Gb: SPのECDSA pubkey
SPID: service provider id
Quote type
KDF-id
SigSP: SPのECDSA署名
CMAC_SMK(A): 上記5つのデータに対するCMAC
SigRL: IASから取得した署名拒絶情報
(ISV -> SP: msg3) ISVがSPにmsg3を送信
ISVのuntrustedがsgx_ra_proc_msg2()をcallし、msg3を生成。
引数は、
msg2: sgx_ra_proc_msg2()へのポインタ
msg3: sgx_ra_get_msg3_trusted()へのポインタ
SPの署名検証
SigRLから署名拒絶情報のcheck
code: msg3
CMAC_SMK(M): 以下3つのデータに対するCMAC
Ga: ISVのECDSA pubkey
PS_SECURITY_PROPERTY: PSEの正当性情報
QUOTE: ISV Enclaveのmetadata構造体
(SP -> ISV: msg4) SPがQuoteをIASに送信し、そのReportに基づきEnclaveを検証
SPが受け取ったmsg3を検証
msg3のGaとmsg1の公開鍵が一致するか
CMACの検証
reportデータの検証
attestationの検証
Quote構造体をmsg3から取得
QuoteをIASに送信しattestation reportが返される。
RAのvalid or invalid
署名証明書の検証
attestation reportの署名を署名証明書により検証
Quote構造体の正当性確認後、Enclaveのattestation statusやセキュリティバージョン等からISVのEnclaveを信頼できるか決定。
SPがmsg4をISVに送信。
Enclaveの信用可否など
code memo
create_attestation_report
ocallでtarget_info structureとepid group idを取得
ocallでsigrlを取得: ocall_get_ias_socket(&mut rt as *mut sgx_status_t, &mut ias_sock as *mut i32)
target_infoとdataを引数にsgx_crate_reportをcallしsgx_report_tを生成
sgx_get_quoteをocallし(*mut sgx_quote_t, uint32_t)を取得
perform_ra <- create_ra_report_and_signature <- create_attestation_report
run_enclave_client <- run_client (enclave)
worker
check for required files
init enclave
init_enclave(): EIDを取得
eidを引数にinit()を実行
worker requests用のws server start
enclave_server strat based mu_ra_port
node communication用のapi clients start
get_ecc_signing_pubkey: TEEの署名公開鍵 ( = address)を取得
Txの署名利用
remote attestation (perform_ra) し、unchecked_extrinsicを生成し、オンチェーンに送し、オンチェーンで検証し、enclaveをオンチェーンに登録。
すでに他のenclaveが登録されている場合は、mutual remote attestationを行う run_enclave_client
eventsのsubscribe
https://github.com/baidu/rust-sgx-sdk/blob/master/samplecode/ue-ra/ue-ra-server/enclave/src/lib.rs#L299
enigma
registerImpl
verify IAS signature
https://api.trustedservices.intel.com/documents/sgx-attestation-api-spec.pdf
signerQuote == _signer
oasis
verify_rak_binding
sdk
Check if the qe_report is produced on the same platform
refs
https://github.com/intel/sgx-ra-sample
https://qiita.com/Cliffford/items/095b1df450583b4803f2
https://github.com/scs/substraTEE-node/blob/acd97f49be1f691c35f567dd79f7391ce9554a9f/host_calls/src/lib.rs#L61
https://github.com/baidu/rust-sgx-sdk/blob/master/samplecode/ue-ra/ue-ra-server/enclave/src/lib.rs#L299
https://www.blackhat.com/docs/us-17/thursday/us-17-Swami-SGX-Remote-Attestation-Is-Not-Sufficient-wp.pdf
Intel® Software Guard Extensions: EPID Provisioning and Attestation Services
http://www.sgx101.com/portfolio/remote_attestation/
https://courses.cs.ut.ee/MTAT.07.022/2017_spring/uploads/Main/hiie-report-s16-17.pdf
https://github.com/scs/substraTEE/blob/master/ATTESTATION.md
Secret sharing after mutual RA with first registered enclave
DCAP
Intel_SGX_OpenSource_Attestation
Intel® Software Guard Extensions (Intel® SGX) Data Center Attestation Primitives: ECDSA Quote Library API
Software attestation
https://gyazo.com/9def75a1606bd42a056eaa949c329f3b